package response;

import exception.ErrorCodeEnum;
import lombok.Data;

@Data
public class BiResponse<T> {

    /**
     * 响应码
     */
    private Integer code;

    /**
     * 响应级别的返回消息
     */
    private String msg;

    /**
     * 响应结果数据
     */
    private T data;

    public static <T> BiResponse<T> createVoidResponse() {
        return new BiResponse<T>();
    }

    public static <T> BiResponse<T> success(T data) {
        BiResponse<T> tBiRequest = new BiResponse<T>();
        tBiRequest.setData(data);
        tBiRequest.setCode(ErrorCodeEnum.SUCCESS.getCode());
        tBiRequest.setMsg(ErrorCodeEnum.SUCCESS.getMsg());
        return tBiRequest;
    }

}
